#include <iostream>
#include <vector>
using namespace std;

int main()
{
	int t = 0;
	cin >> t;
	vector<vector<long long>> ret;
	while (t--)
	{
		long long a, b, c, k;
		cin >> a >> b >> c >> k;
		while (k--)
		{
			long long x = floor((b + c) / 2);
			long long y = floor((a + c) / 2);
			long long z = floor((b + a) / 2);
			a = x;
			b = y; 
			c = z;
		}
		vector<long long> v;
		v.push_back(a);
		v.push_back(b);
		v.push_back(c);
		ret.push_back(v);
	}
	for (int i = 0; i < ret.size(); i++)
	{
		for (int j = 0; j < ret[0].size(); j++)
		{
			cout << ret[i][j] << " ";
		}
		cout << endl;
	}
	return 0;
}